<?php
/**
 * @category   BRail
 * @package    BRail_Application_Controller
 */
abstract class BRail_Application_Controller_Abstract extends Zend_Controller_Action
{
    /**
     * Initialize object
     *
     * Called from {@link __construct()} as final step of object instantiation.
     *
     * @return void
     */
    public function init()
    {
        $this->view->translationEnabled = Zend_Registry::get('Zend_Application')->getOption('translationEnabled');
    }

    /**
     * Prepare the renderer for data/ajax output
     *
     * Disables any layout, and informr the renderer there's no need to set up view objects
     *
     * @return void
     */
    protected function _setAjaxOutput()
    {
        $this->_helper->layout->disableLayout();
        $this->getHelper('viewRenderer')->setNoRender();
    }

    /**
     * Get bootstrap
     * @return Zend_Application_Bootstrap_Bootstrap
     */
    protected function _getBootstrap()
    {
        return $this->getInvokeArg('bootstrap');
    }

    /**
     * Get application
     * @return Application
     */
    protected function _getApplication()
    {
        return $this->_getBootstrap()->getApplication();
    }
}